package Homework5

import akka.actor.Actor

import scala.beans.BeanProperty

class Worker extends Actor{
//  @BeanProperty var name: String = "worker1"
//  def this(name: String){
//    this()
//    this.name = name
//  }

  override def receive: Receive = {
    case "注册成功" => {
      while (true){
        Thread.sleep(3000)
        println(context.self.path.name + "发送心跳")
        sender() ! context.self.path.toString
      }
    }
  }
}
